﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WPF.DataBinding.DataContext;

namespace WPF.DataBinding.DataTemplate
{
    /// <summary>
    /// Interaction logic for DataTemplateWindow.xaml
    /// </summary>
    public partial class DataTemplateWindow : Window
    {
        List<Person> people = new List<Person>();
        public DataTemplateWindow()
        {
            InitializeComponent();
            Person source = new Person { Name = "Ahmet", Surname = "Demir", Age = 26 };
            Person source2 = new Person { Name = "Ömer", Surname = "Demir", Age = 25 };
            Person source3 = new Person { Name = "Derya", Surname = "Demir", Age = 55 };
            people.Add(source);
            people.Add(source2);
            people.Add(source3);
            grdDataContext.DataContext = people;
        }

        private void btnShow_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show("Person name: " + source.Name + ", person surname: " + source.Surname + ", person age: " + source.Age);
        }

        private void btnChange_Click(object sender, RoutedEventArgs e)
        {
            //source.Age++;
        }
    }
}
